// 导入路由
import {
  BrowserRouter as Router,
  Route,
  Switch,
  Redirect,
} from 'react-router-dom'
import Layout from 'pages/Layout'
import Login from 'pages/Login'
import NotFound from 'pages/NotFound'
import AuthRoute from 'components/AuthRoute'
import history from 'utils/history'
function App() {
  return (
    <Router history={history}>
      <div className="App">
        <Switch>
          <Redirect exact from="/" to="/home"></Redirect>
          <AuthRoute path="/home" component={Layout}></AuthRoute>
          <Route
            path="/login"
            render={(props) => {
              console.log(props)
              return <Login {...props} />
            }}
          ></Route>
          <Route component={NotFound}></Route>
        </Switch>
      </div>
    </Router>
  )
}

export default App
